using System.ComponentModel;
using System.Windows.Data;
using Telerik.Windows.Controls.RibbonView;
using GalaSoft.MvvmLight.Command;
using System.Windows;

namespace Rio.Framework.Pages.Controls.Navigation
{
    public class ButtonViewModel : INotifyPropertyChanged
    {

        #region Fields

        private string text;
        private bool isEnabled;

        #endregion

        #region Events

        public event PropertyChangedEventHandler PropertyChanged;

        /// <summary>
        /// Called when [property changed].
        /// </summary>
        /// <param name="propertyName">Name of the property.</param>
        protected void OnPropertyChanged(string propertyName)
        {
            if (this.PropertyChanged != null)
            {
                this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }

        #endregion

        #region Constructors

        /// <summary>
        /// Initializes a new instance of the <see cref="ButtonViewModel" /> class.
        /// </summary>
        public ButtonViewModel()
        {
            isEnabled = true;
        }

        #endregion

        #region Properties


        /// <summary>
		///     Gets or sets Text.
		/// </summary>
		public string Text
		{
			get
			{
				return this.text;
			}
			set
			{
				if (this.text != value)
				{
					this.text = value;
					this.OnPropertyChanged("Text");
				}
			}
		}

        /// <summary>
        /// Gets or sets the size.
        /// </summary>
        /// <value>The size.</value>
        public ButtonSize Size { get; set; }

        /// <summary>
        /// Gets or sets the small image.
        /// </summary>
        /// <value>The small image.</value>
        public string SmallImage { get; set; }

        /// <summary>
        /// Gets or sets the large image.
        /// </summary>
        /// <value>The large image.</value>
        public string LargeImage { get; set; }

        /// <summary>
        /// Gets or sets the name.
        /// </summary>
        /// <value>The name.</value>
        public string Name { get; set; }

        /// <summary>
        /// Gets or sets the is enabled.
        /// </summary>
        /// <value>The is enabled.</value>
        public bool IsEnabled
        {
            get
            {
                return isEnabled;
            }
            set
            {
                isEnabled = value;
                this.OnPropertyChanged("IsEnabled");
                this.OnPropertyChanged("IsVisible");
            }
        }

        /// <summary>
        /// Gets or sets the is quick access.
        /// </summary>
        /// <value>The is quick access.</value>
        public bool IsQuickAccess { get; set; }

        /// <summary>
        /// Gets or sets a value indicating whether this instance is visible when disabled.
        /// </summary>
        /// <value>
        /// 	<c>true</c> if this instance is visible when disabled; otherwise, <c>false</c>.
        /// </value>
        public bool isVisibleWhenDisabled { get; set; }

        /// <summary>
        /// Gets the is visible.
        /// </summary>
        public Visibility IsVisible
        {
            get
            {
                if (!isEnabled && !isVisibleWhenDisabled)
                {
                    return Visibility.Collapsed;
                }
                return Visibility.Visible;
            }
        }

        public RelayCommand<string> Command { get; set; }

        #endregion
    }
}
